package multi.data;

import android.app.Activity;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.VideoView;

public class Hasil extends Activity{
	Button Editor, Share;
	Bundle extras;
	String path;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hasil);
		
		extras = getIntent().getExtras();
		if (extras == null) {
			path = null;
		} else {
			path = extras.getString("path");
		}
		
		videoPlayer(path, true);
		
		Share = (Button) findViewById(R.id.buttonESshare);
		Share.setOnClickListener(new OnClickListener() {
			
			public void onClick(View arg0) {
				Intent share = new Intent(getApplicationContext(), Share.class);
				share.putExtra("path", "videopath");
				startActivity(share);
			}
		});
		
	}
	
	public void videoPlayer(String path, boolean autoplay) {
		getWindow().setFormat(PixelFormat.TRANSLUCENT);
		VideoView videoHolder = (VideoView) findViewById(R.id.videoViewEditShare);
		videoHolder.setMediaController(new MediaController(this));
		videoHolder.setVideoURI(Uri.parse(path));
		videoHolder.requestFocus();
		if (autoplay) {
			videoHolder.start();
		}
	}
}